﻿namespace OboutInc.EasyMenu_Pro
{
    using System;
    using System.ComponentModel;
    using System.Drawing.Design;
    using System.Web.UI;
    using System.Web.UI.Design;
    using System.Xml;

    [Serializable, ToolboxItem(false)]
    public abstract class ItemBase : Control, INamingContainer
    {
        protected ItemBase()
        {
        }

        public abstract void Deserialize(XmlElement parentNode);
        public override bool Equals(object obj)
        {
            return (base.ID == ((ItemBase) obj).ID);
        }

        protected override void Render(HtmlTextWriter writer)
        {
            if (this.InnerHtml != string.Empty)
            {
                writer.Write(this.InnerHtml);
            }
            else
            {
                base.Render(writer);
            }
        }

        public abstract void Serialize(ref XmlElement parentNode);

        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public abstract string AddonAttributes { get; }

        public abstract bool AllowsIcon { get; set; }

        public abstract bool AutoHideMenu { get; set; }

        public static string Component
        {
            get
            {
                return "easyMenuItem";
            }
        }

        public static string ComponentContentCell
        {
            get
            {
                return "easyMenuItemContentCell";
            }
        }

        public static string ComponentContentCellOver
        {
            get
            {
                return "easyMenuItemContentCellOver";
            }
        }

        public static string ComponentIconCell
        {
            get
            {
                return "easyMenuItemIconCell";
            }
        }

        public static string ComponentIconCellOver
        {
            get
            {
                return "easyMenuItemIconCellOver";
            }
        }

        public static string ComponentLeftRoundCornerCell
        {
            get
            {
                return "easyMenuItemLeftRoundCornerCell";
            }
        }

        public static string ComponentLeftRoundCornerCellOver
        {
            get
            {
                return "easyMenuItemLeftRoundCornerCellOver";
            }
        }

        public static string ComponentOver
        {
            get
            {
                return "easyMenuItemOver";
            }
        }

        public static string ComponentRightRoundCornerCell
        {
            get
            {
                return "easyMenuItemRightRoundCornerCell";
            }
        }

        public static string ComponentRightRoundCornerCellOver
        {
            get
            {
                return "easyMenuItemRightRoundCornerCellOver";
            }
        }

        public static string ComponentSubMenuCell
        {
            get
            {
                return "easyMenuItemSubMenuCell";
            }
        }

        public static string ComponentSubMenuCellOver
        {
            get
            {
                return "easyMenuItemSubMenuCellOver";
            }
        }

        [Description("Image to show near the MenuComponent."), Bindable(true), DefaultValue(""), Editor(typeof(UrlEditor), typeof(UITypeEditor)), Category("Appearance")]
        public abstract string Icon { get; set; }

        [Description("Text or any client side code to display."), NotifyParentProperty(true), Bindable(true), Category("Behavior"), DefaultValue("")]
        public abstract string InnerHtml { get; set; }
    }
}

